/*
 * Instance
 * 
 * Project: Search Engine
 * 
 * Copy right 2012 by Phan Hoàn Vũ
 * Email hoanvuphan@gmail.com
 */

package hcmus.fit.ml.tr.data;

import java.util.HashMap;
import java.util.Map;

/**
 * @author hvp
 *
 */
public class Instance {
    private static Long AUTO_INCREASE_ID = 0L;
    private String id;
    private Map<String, Object> data;

    public Instance() {
        this.data = new HashMap<String, Object>();
    }

    public Object get(String key) {
        return data.get(key);
    }

    public void addAttribute(String attrName, Object attrValue) {
        data.put(attrName, attrValue);
        id = AUTO_INCREASE_ID.toString();
        AUTO_INCREASE_ID++;
    }

    public String getId() {
        return id;
    }
}
